from django.contrib import admin
from .models import Student, Teacher, Course, StudentScore, TeacherRating

@admin.register(Student)
class StudentAdmin(admin.ModelAdmin):
    list_display = ('student_id', 'name', 'gender', 'grade', 'major', 'user')
    search_fields = ('student_id', 'name')
    list_filter = ('gender', 'grade', 'major')

@admin.register(Teacher)
class TeacherAdmin(admin.ModelAdmin):
    list_display = ('teacher_id', 'name', 'gender', 'title', 'department')
    search_fields = ('teacher_id', 'name')
    list_filter = ('gender', 'title', 'department')

@admin.register(Course)
class CourseAdmin(admin.ModelAdmin):
    list_display = ('code', 'name', 'teacher')
    search_fields = ('code', 'name', 'teacher__name')
    list_filter = ('teacher',)

@admin.register(StudentScore)
class StudentScoreAdmin(admin.ModelAdmin):
    list_display = ('student', 'course', 'score', 'created_at')
    search_fields = ('student__name', 'course__name')
    list_filter = ('course',)

@admin.register(TeacherRating)
class TeacherRatingAdmin(admin.ModelAdmin):
    list_display = ('student', 'teacher', 'course', 'rating', 'created_at')
    search_fields = ('student__name', 'teacher__name', 'course__name')
    list_filter = ('teacher', 'course', 'rating') 